package com.whcoding.more.datasource.mybatis.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.whcoding.more.datasource.mybatis.mapper.OrmDeptMapper;
import com.whcoding.more.datasource.mybatis.vo.OrmDeptVO;
import com.whcoding.more.datasource.mybatis.service.OrmDeptService;
import org.springframework.stereotype.Service;

/**
 * @program: spring-boot-learning
 * @description: 数据服务层实现
 * @author: whcoding
 * @create: 2022-06-27 18:08
 **/
@Service
@DS("slave")
public class OrmDeptServiceImpl extends ServiceImpl<OrmDeptMapper, OrmDeptVO> implements OrmDeptService {

	/**
	 * 类上 {@code @DS("slave")} 代表默认从库，在方法上写 {@code @DS("master")} 代表默认主库
	 *
	 * @param dept 用户
	 */
	@DS("master")
	@Override
	public void addDept(OrmDeptVO dept) {
		baseMapper.insert(dept);
	}
}
